﻿#region

using System;
using System.Xml.Serialization;
using DotNetMax.CodeGen.Model.Collection;

#endregion

namespace DotNetMax.CodeGen.Model.Entity
{
    /// <summary>
    /// Entidade de Manifesto de PlugIn
    /// </summary>
    public class PlugInManifest
    {
        #region Constructor

        public PlugInManifest(string type, string version, DateTime lastReleaseDate, string category,
                              string shortDescription, ExtendedPlugInManifest extendedInfo)
        {
            _Type = type;
            _Version = version;
            _LastReleaseDate = lastReleaseDate;
            _Category = category;
            _ShortDescription = shortDescription;
            _ExtendedInfo = extendedInfo;
        }

        public PlugInManifest(string type, string version, DateTime lastReleaseDate, string category,
                              string shortDescription)
        {
            _Type = type;
            _Version = version;
            _LastReleaseDate = lastReleaseDate;
            _Category = category;
            _ShortDescription = shortDescription;
        }

        public PlugInManifest()
        {
        }

        #endregion

        #region Fields

        private string _Category;
        private ExtendedPlugInManifest _ExtendedInfo;
        private PlugInFileCollection _FilesInPlugIn = new PlugInFileCollection();
        private DateTime _LastReleaseDate;
        private string _ShortDescription;
        private string _Type;
        private string _Version;

        #endregion

        #region Properties

        /// <summary>
        /// Retorna o Tipo do PlugIn
        /// </summary>
        [XmlAttribute("Type")]
        public string Type
        {
            get { return _Type; }
            set { _Type = value; }
        }

        /// <summary>
        /// Retorna a Versão do PlugIn
        /// </summary>
        [XmlAttribute("Version")]
        public string Version
        {
            get { return _Version; }
            set { _Version = value; }
        }

        /// <summary>
        /// Retorna a Data do Último Release do PlugIN
        /// </summary>
        [XmlAttribute("LastReleaseDate")]
        public DateTime LastReleaseDate
        {
            get { return _LastReleaseDate; }
            set { _LastReleaseDate = value; }
        }

        /// <summary>
        /// Retorna a Categoria do PlugIn
        /// </summary>
        [XmlAttribute("Category")]
        public string Category
        {
            get { return _Category; }
            set { _Category = value; }
        }

        /// <summary>
        /// Retorna uma Descrição Curta do PlugIn
        /// </summary>
        [XmlAttribute("ShortDescription")]
        public string ShortDescription
        {
            get { return _ShortDescription; }
            set { _ShortDescription = value; }
        }

        /// <summary>
        /// Retorna Informações Extendidas sobre o PlugIn
        /// </summary>
        [XmlElement("ExtendedInfo")]
        public ExtendedPlugInManifest ExtendedInfo
        {
            get { return _ExtendedInfo; }
            set { _ExtendedInfo = value; }
        }

        /// <summary>
        /// Contém a Definição dos Arquivos do PlugIn
        /// </summary>
        [XmlArray("FilesInPlugIn")]
        [XmlArrayItem("FileInPlugIn")]
        public PlugInFileCollection FilesInPlugIn
        {
            get { return _FilesInPlugIn; }
            set { _FilesInPlugIn = value; }
        }

        #endregion
    }
}